﻿@using System.Data;
@using Libraries;
@using MvcPager;
@using WEF.MvcPager;
@model PagedList<DataRow>
@{
    ViewBag.Title = "Index";
    Layout = "~/Areas/Manager/Views/Shared/_Layout.cshtml";
    var tableName = Request.QueryString["tableName"];
}
<div class="row-fluid">
    <div class="datatable span12">
        <div class="navbar">
            <div class="navbar-inner">
                <div class="btn-toolbar pull-left"><a title='创建新记录' class="btn btn-primary" href="/Manager/DataBase/CreateRecord?tableName=@Url.Encode(tableName)">创建新记录</a> <a title='清空表记录' class="btn btn-primary" href="javascript:;" onclick="truncateTable('@Url.Encode(tableName)')">清空表记录</a> <a class="btn" href="/Manager/DataBase/Index">返 回</a></div>
                <div class="nav-collapse pull-right">
                    <ul class="nav">
                        <li class="active"><a href="javascript:void(0);"><i class="icol-table"></i>列表</a></li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="dt-pages tab-content">
            <div class="dt_header">
                <form action="" method="get">
                    <div class="row-fluid">
                        <div class="span6">
                        </div>
                        <div class="span6">
                            <div class="pull-right">
                                <label>
                                    <select name="pagesize" class="input-mini">
                                        <option value="10" selected="selected">10</option>
                                        <option value="25">25</option>
                                        <option value="50">50</option>
                                        <option value="100">100</option>
                                    </select>
                                    条记录每页
                                </label>
                            </div>
                        </div>
                    </div>
                    <div class="alert alert-info" id="control_search" style="display: none">
                        <div class="clearfix"></div>
                    </div>
                </form>
            </div>
            <div class="dataTables_wrapper">
                @Html.Partial("_List", Model, ViewData)
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    function truncateTable(tableName) {
        if (confirm("确定要清空表中所有数据吗？")) {
            $.get("/Manager/DataBase/TruncateTable?rnd=" + (new Date().getMilliseconds()), { "tableName": tableName }, function (data) {
                location.reload();
            });
        }
    }
</script>